import os

from pydantic import BaseSettings

"""
项目配置
"""


class Settings(BaseSettings):
    # 项目根路径
    BASE_PATH: str = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
    APPS_PATH: str = os.path.join(BASE_PATH, "apps")  # Apps路径
    CONFIG_PATH: str = os.path.join(BASE_PATH, "config")  # 配置文件路径
    LOGS_PATH: str = os.path.join(BASE_PATH, "logs")  # 日志路径
    APPIUM_LOG_PATH: str = os.path.join(LOGS_PATH, "appium_log")  # appium日志路径

    # redis配置
    REDIS_HOST: str = "127.0.0.1"
    REDIS_PASSWORD: str = ""
    REDIS_DB: int = 0
    REDIS_PORT: int = 6379
    REDIS_URL: str = f"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}?encoding=utf-8"
    REDIS_TIMEOUT: int = 5  # redis连接超时时间

settings = Settings()
